package com.ling.simul.controller;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ling.simul.service.MppCalService;
import com.ling.simul.vo.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("mppCal")
@Api(value = "连退力学性能-检测仪", tags = "连退力学性能-检测仪")
public class MppCalController {

    @Autowired
    private MppCalService mppCalService;


    @PostMapping("historyTable")
    @ApiOperation("历史列表")
    public ResultData findHistoryTable(@RequestBody JSONObject json) throws JsonProcessingException {
        return mppCalService.historyTable(json,"/mpp/historyTable2");
    }
    @PostMapping("historyStatic")
    @ApiOperation("历史static")
    public ResultData historyStatic(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.historyeStatic(jsonObject,"/mpp/historyStatic");
    }

    @PostMapping("modelEvaluation")
    @ApiOperation("模型精度ModelEvaluation")
    public ResultData modelEvaluation(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.modelEvaluation(jsonObject,"/mpp/modelEvaluation");
    }

    @PostMapping("predictTrend")
    @ApiOperation("模型精度PredictTrend")
    public ResultData predictTrend(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.predictTrend(jsonObject,"/mpp/predictTrend");
    }

    @PostMapping("getShopSignCode")
    @ApiOperation("模型精度getShopSignCode")
    public ResultData getShopSignCode(@RequestBody JSONObject jsonObject){
        return mppCalService.getShopSignCode(jsonObject,"/mpp/getShopSignCode");
    }


    @PostMapping("sampTable")
    @ApiOperation("取样列表sampTable")
    public ResultData sampTable(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.sampTable(jsonObject,"/mpp/sampTable");
    }

    @PostMapping("processLine")
    @ApiOperation("工艺详情-重要工艺曲线processLine")
    public ResultData processLine(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.processLine(jsonObject,"/mpp/processLine");
    }

    @PostMapping("mppChange")
    @ApiOperation("mppChange-mppChange")
    public ResultData mppChange(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.mppChange(jsonObject,"/mpp/processLine");
    }

    @PostMapping("mppChange2")
    @ApiOperation("mppChange-mppChange2")
    public ResultData mppChange2(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.mppChange2(jsonObject,"/mpp/processLine");
    }


    @PostMapping("getNewCoilId")
    @ApiOperation("getNewCoilId")
    public ResultData getNewCoilId(@RequestBody JSONObject jsonObject){
        return mppCalService.getNewCoilId(jsonObject,"/mpp/processLine");
    }

    @PostMapping("findAllByMatNo")
    @ApiOperation("findAllByMatNo")
    public ResultData findAllByMatNo(@RequestBody JSONObject jsonObject) throws JsonProcessingException {
        return mppCalService.findAllByMatNo(jsonObject,"/mpp/processLine");
    }
}
